package com.techwells.applicationMarket.service;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class QuartRun {
	
	@Resource
	private QuartzService quartzService;
	
	private Logger logger=LoggerFactory.getLogger(QuartRun.class);
	
	/**
	 * 每24小时执行的任务
	 */
	@Scheduled(cron="0 0 0 * * ?")
	public void run24(){
		
		try {
			quartzService.resetDownloadCountAdd(); 
		} catch (Exception e) {
			logger.error("重置下载增加次数为0异常",e);
		}
		
		try {
			quartzService.cleanTaskCount();
		} catch (Exception e) {
			logger.error("清空任务数量为0异常",e);
		}
	}
	
	/**
	 * 每一秒执行的任务
	 */
	@Scheduled(cron="0/1 * * * * ?")
	public void run(){
		quartzService.setBlock();
		quartzService.getMoacTrasactionDetail();
		quartzService.addUserMessage();
	}
}
